package com.zxx.paysdk.service.impl

import com.zqq.baselibrary.ext.convert
import com.zqq.baselibrary.ext.convertBoolean
import com.zqq.baselibrary.ext.excute
import com.zxx.paysdk.service.PayService
import com.zxx.paysdk.service.repository.PayRepository
import rx.Observable
import javax.inject.Inject

/**
 * 支付 业务实现类
 * wc
 * @author zqq on 2019/9/28.
 */
class PayServiceImpl @Inject constructor() : PayService {

    @Inject
    lateinit var repository: PayRepository

    //获取支付签名
    override fun getPaySign(orderId: Int, totalPrice: Long): Observable<String> {
        return repository.getPaySign(orderId, totalPrice)
                .convert()
    }

    //支付订单，同步订单状态
    override fun payOrder(orderId: Int): Observable<Boolean> {
        return repository.payOrder(orderId)
                .convertBoolean()
    }
}